#pragma once

#define REGISTERABILITY(ability, func) static bool ___init = Game::RegisterAbility(#ability, ability::func)

#include <list>
#include <vector>
#include <map>
#include "Pointer.h"
#include "Time.h"
#include "HashedString.h"

namespace Combat
{
	class Combatant;

	class IAbility
	{
	public:
		typedef Pointer<IAbility> (*CreateFunction)( Combatant* );
		typedef std::map<HashedString, CreateFunction> CreatorMap_t;
		typedef std::pair<HashedString, CreateFunction> CreatorPair_t;
		typedef std::list<Pointer<IAbility>> List_t;
		typedef std::vector<Pointer<IAbility>> Vector_t;
		
		virtual const HashedString& Type() = 0;

		IAbility( Combatant* combatComponent );
		virtual ~IAbility() {};

		void setCooldownTime();
		bool isOffCooldown();
		Combatant*& Owner();
	protected:
		float m_cooldown;				// cooldown in seconds
		Time m_cooldownTimer;
		Combatant* m_owner;
	};
};